-- Prefan Access Controller

AddCSLuaFile( "autorun/pacinit.lua" )

local function PrintLoading()

	print( "-----------------------------" )
	print( "PAC Loading" )
	print( "Created by " .. PAC.Info.Author )
	print( "Version " .. PAC.Info.Version )
	print( "-----------------------------" )

end

local function LoadVariables()

	PAC = {}
	PAC.Info = {}
		PAC.Info.Author = "Prefanatic"
		PAC.Info.Version = "ALPHA 1"
	PAC.DebugEnabled = false
		
end

function pacInit()

	LoadVariables()
	PrintLoading()
	
	if SERVER then
	
		include( "pac/sv_init.lua" )
		include( "pac/sv_data.lua" )
		include( "pac/sv_commands.lua" )
		
		AddCSLuaFile( "pac/cl_derma.lua" )
		AddCSLuaFile( "pac/sh_umsg.lua" )
		AddCSLuaFile( "pac/sh_access.lua" )
		AddCSLuaFile( "pac/sh_print.lua" )
		AddCSLuaFile( "pac/sh_plugins.lua" )
		
	elseif CLIENT then
	
		include( "pac/cl_derma.lua" )
		
	end
	
	include( "pac/sh_umsg.lua" )
	include( "pac/sh_access.lua" )
	include( "pac/sh_print.lua" )
	include( "pac/sh_plugins.lua" )
	
	PAC.LoadPlugins()
	
end

pacInit()

concommand.Add( "PAC_Reload", function( ply, _, args )

	if PAC.IsAllowed( ply, PAC.Reload ) then
	
		PAC.Print( PAC_CHAT_ALL, Color( 255, 0, 0 ), ply:Nick(), Color( 100, 100, 100 ), " has reloaded PAC!" )

		pacInit()
		
	end
	
end)
